package org.example.userToUserEnum;

/**
 * @FileName FollowStatus
 * @Description
 * @Author coderfun
 * @selfDesc coding in fun
 * @date 2024-12-04
 **/
public enum FollowStatus {
    FOLLOWING(1, "正在关注"),
    UNFOLLOWED(2, "取消关注");

    private final int code;
    private final String description;

    FollowStatus(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static FollowStatus fromCode(int code) {
        for (FollowStatus status : FollowStatus.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown code: " + code);
    }
}

